package com.ps;

import org.glassfish.tyrus.server.Server;

import java.util.Collections;

public class WSServer {

    /**
     * WebSocket服务器启动入口
     */
    public static void main(String[] args) {
        // 创建Tyrus服务器实例
        Server server = new Server(
                "localhost",
                8025,
                "/",
                Collections.emptyMap(),
                PortScanEndpoint.class
        );
        try {
            server.start();
            System.out.println("Server started at ws://localhost:8025/portscan");
            Thread.currentThread().join();// 阻塞主线程保持服务运行
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            server.stop();
        }
    }
}
